<?php
header("content-type:text/html;charset=utf8");
$username = $_POST['username'];
$password = $_POST['password'];

$con = mysqli_connect('127.0.0.1','root','rootroot','goods');
$sql = "select * from user where username='$username' and password='$password'";
$res = mysqli_query($con,$sql);
$row = mysqli_fetch_assoc($res);

if($row){
    $arr = [
        "meta" => [
            "status" => 1,
            "msg" => "登录成功"
        ]
    ];
}else{
    $arr = [
        "meta" => [
            "status" => 2,
            "msg" => "登录失败"
        ]
    ];
}
echo json_encode($arr);